package com.hu.zhcc.shiro.controller.dingming;

import com.hu.zhcc.common.entity.Page;
import com.hu.zhcc.shiro.entity.dingming.TSetmeal;
import com.hu.zhcc.shiro.service.dingming.TSetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/tSetmeal")
public class TSetmealController {
    @Autowired
    private TSetmealService tSetmealService;

    @GetMapping("")
    public ResponseEntity<Page<TSetmeal>> getSetmealList(@RequestParam(required = false) String name,
                                                      @RequestParam(required = false) Integer status,
                                                      Integer offset, Integer limit) {
        System.out.println("name="+name+",status="+status+",offset="+offset+",limit="+limit);
        Map<String, Object> paremeters = new HashMap<String, Object>();
        paremeters.put("name", name);
        paremeters.put("status", status);
        Page<TSetmeal> result = tSetmealService.listTSetmeal(paremeters, offset, limit);
        System.out.println("result="+result.getTotal());
        return ResponseEntity.ok(result);
    }
}

